home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
- /* shk.c - version 1.0.3 */
-
- #include "hack.h"
- #include "mfndpos.h"
- #include "mkroom.h"
- #include "eshk.h"
-
- #define ESHK(mon) ((struct eshk *)(&(mon->mextra[0])))
- #define NOTANGRY(mon) mon->mpeaceful
- #define ANGRY(mon) !NOTANGRY(mon)
-
- extern char plname[], *xname();
- extern struct obj *o_on(), *bp_to_obj();
-
- /* Descriptor of current shopkeeper. Note that the bill need not be
- per-shopkeeper, since it is valid only when in a shop. */
- extern struct monst *shopkeeper;
- extern struct bill_x *bill;
- extern int shlevel; /* level of this shopkeeper */
- extern struct obj *billobjs; /* objects on bill with bp->useup */
- /* only accessed here and by save & restore */
- extern long int total; /* filled by addupbill() */
- extern long int followmsg; /* last time of follow message */
-
- /*
- invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
- obj->quan <= bp->bquan
- */
-
-
- extern char shtypes[];
-
- extern char *shopnam[];
-
- extern char *shkname();
-
- extern struct bill_x *onbill();
-
- dopay2(shkp)
- register struct monst *shkp;
- {
- long ltmp;
- pline("But in order to appease %s,",
- amonnam(shkp, "angry"));
- if(u.ugold >= 1000){
- ltmp = 1000;
- pline(" you give him 1000 gold pieces.");
- } else {
- ltmp = u.ugold;
- pline(" you give him all your money.");
- }
- pay(ltmp, shkp);
- if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ)
- || rn2(3)){
- pline("%s calms down.", Monnam(shkp));
- NOTANGRY(shkp) = 1;
- } else pline("%s is as angry as ever.",
- Monnam(shkp));
- /*end dopay2*/}
-